<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopTemplateMissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_mission_template', function (Blueprint $table) {
            $table->id();
            $table->string('name', 32)->default('')->comment('任务名称');
            $table->unsignedTinyInteger('missionType')->default(0)->comment('任务类型 1审批 2协办');
            $table->unsignedTinyInteger('mainStep')->default(0)->comment('任务所属阶段 主表step');
            $table->unsignedTinyInteger('stepStatus')->default(0)->comment('任务所属阶段状态 1商家待支付 2商家待签署 3开发待指派 4选址待提交 5商家待确认');
            $table->unsignedTinyInteger('handlerType')->default(0)->comment('任务处理人类型 1内部员工 2商家');
            $table->unsignedSmallInteger('handlerDay')->default(0)->comment('任务处理天数');
            $table->unsignedTinyInteger('extendHandler')->default(0)->comment('当前节点是否根据上一节点指派生成处理人 0否 1是');
            $table->unsignedTinyInteger('handlerRole')->default(0)->comment('任务处理角色 1开发负责人 2筹备负责人');
            $table->unsignedTinyInteger('handlerRule')->default(0)->comment('任务处理规则 1属地指派 2总部指派');
            $table->unsignedInteger('exceptionHandlerId')->default(0)->comment('异常处理人 用哪个id待定');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '开店 - 任务模板管理';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_mission_template');
    }
}
